cmake_minimum_required(VERSION 3.10)

#project(north_dlt698)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Os -fPIC")

aux_source_directory(./src SRC)

#include_directories
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../common/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../logger/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../db/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../modbus/include)
#library_directories
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)

add_library(north_dlt698 SHARED ${SRC}) # 生成动态库或共享库
SET_TARGET_PROPERTIES(north_dlt698 PROPERTIES VERSION 1.0.0 SOVERSION 1)

install(TARGETS north_dlt698 LIBRARY DESTINATION ${CMAKE_LIBRARY_PATH})

add_custom_command(TARGET  north_dlt698
        POST_BUILD
        COMMAND echo "north_dlt698 builded finished."
        COMMAND ${CMAKE_STRIP} "$<TARGET_FILE:north_dlt698>"
        #COMMAND ${CMAKE_COMMAND} -E copy  "${CMAKE_CURRENT_SOURCE_DIR}/include/global.h" ${CMAKE_INCLUDE_PATH}/global.h
#        COMMAND ${CMAKE_COMMAND} -E copy  $<TARGET_FILE:north_dlt698> ${CMAKE_LIBRARY_PATH}/libnorth_dlt698.so 
       COMMENT  "north_dlt698 is install finished"
       )